package com.ist.smartmonitor.util;

import com.ist.data.AbstractData;
import com.ist.data.Vehicle;
import com.ist.smartmonitor.shared.AbstractDto;
import com.ist.smartmonitor.shared.VehicleDto;

public class Converter {

	public static AbstractDto convertAbstractDataToDto (AbstractData data) {
		if(data instanceof Vehicle) {
			Vehicle vehicle = (Vehicle) data;
			return convertVehicleToDto(vehicle);
		}
		return null;
	}

	private static VehicleDto convertVehicleToDto(Vehicle vehicle) {
		VehicleDto dto = new VehicleDto();
		dto.setId(vehicle.getId());
		dto.setBatteryLevel(vehicle.getBatteryLevel());
		return dto;
	}
	
}
